package com.ruoze.bdp.utils;

import java.text.SimpleDateFormat;
import java.util.Date;


public class TimeUtils {
    public static final String FORMAT_8 = "yyyyMMdd";
    public static final String FORMAT_8_TEXT = "yyyy-MM-dd";
    public static final String FORMAT_14_TEXT = "yyyy-MM-dd HH:mm:ss";

    public static String getCurrentTime(String format){
        return getTimeInFormat(new Date(), format);
    }

    private static String getTimeInFormat(Date date, String format) {
        if(date == null){
            return "";
        }
        return new SimpleDateFormat(format).format(date);
    }
}
